using System;
using System.Collections.Generic;
using System.Text;
using BusinessObjects.BO_Actions.NewsLetters;
using Entity.StoreProcedure;
using BusinessObjects;
using System.Data;
namespace BusinessObjects.BO_GetObjects 
{
	public static class BO_NewsLetters
	{
		public static DataTable SelectAll(int status)
		{
			try
			{
				BONewsLetters_Select_All action = new BONewsLetters_Select_All();
				usp_NewsLetters_Select_All entity = new usp_NewsLetters_Select_All();
				entity.STATUS = status;
				return action.ExecuteAndReturnDataTable(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static DataTable SelectTop(int rows, int status)
		{
			try
			{
				BONewsLetters_Select_Top action = new BONewsLetters_Select_Top();
				usp_NewsLetters_Select_Top entity = new usp_NewsLetters_Select_Top();
				entity.NUMBERRECORD = rows;
				entity.STATUS = status;
				return action.ExecuteAndReturnDataTable(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static DataTable Search(int  news_letter_id)
		{
			try
			{
				BONewsLetters_Search action = new BONewsLetters_Search();
				usp_NewsLetters_Search entity = new usp_NewsLetters_Search();
				entity.NEWS_LETTER_ID = news_letter_id;
				return action.ExecuteAndReturnDataTable(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static DataTable SelectWithPaged(int startIndex, int pageCount, int status)
		{
			try
			{
				BONewsLetters_Select_WithPaged action = new BONewsLetters_Select_WithPaged ();
				usp_NewsLetters_Select_WithPaged entity = new usp_NewsLetters_Select_WithPaged ();
				entity.STARTINDEX = startIndex;
				entity.MAXRECORDS = pageCount;
				entity.STATUS = status;
				return action.ExecuteAndReturnDataTable(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static string Insert( string email, DateTime create_date, int status)
		{
			try
			{
				BONewsLetters_Insert action = new BONewsLetters_Insert();
				usp_NewsLetters_Insert entity = new usp_NewsLetters_Insert();
				entity.EMAIL = email;
				entity.CREATE_DATE = create_date;
				entity.STATUS = status;
				return action.ExecuteAndReturnStringValue(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static string Update( int news_letter_id, string email, DateTime create_date, int status)
		{
			try
			{
				BONewsLetters_Update action = new BONewsLetters_Update();
				usp_NewsLetters_Update entity = new usp_NewsLetters_Update();
				entity.NEWS_LETTER_ID = news_letter_id;
				entity.EMAIL = email;
				entity.CREATE_DATE = create_date;
				entity.STATUS = status;
				return action.ExecuteAndReturnStringValue(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static bool Delete(int news_letter_id)
		{
			try
			{
				BONewsLetters_Delete action = new BONewsLetters_Delete();
				usp_NewsLetters_Delete entity = new usp_NewsLetters_Delete();
				entity.NEWS_LETTER_ID = news_letter_id;
				return action.ExecuteAndReturnBooleanValue(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static bool Restore(int news_letter_id)
		{
			try
			{
				BONewsLetters_Restore action = new BONewsLetters_Restore();
				usp_NewsLetters_Restore entity = new usp_NewsLetters_Restore();
				entity.NEWS_LETTER_ID = news_letter_id;
				return action.ExecuteAndReturnBooleanValue(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
	}
}

